//
//  WHNPlayListViewController.m
//  YiQiTingShu
//
//  Created by dllo on 15/11/10.
//  Copyright © 2015年 直到世界的尽头. All rights reserved.
//

#import "WHNPlayListViewController.h"
#import "AFTools.h"
#import <MJExtension.h>
#import "WHNList.h"
#import "PlayerButton.h"
#import "FitHeader.h"

@interface WHNPlayListViewController ()<UITableViewDataSource, UITableViewDelegate>
@property(nonatomic, strong)UITableView *tableView;

@end

@implementation WHNPlayListViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    [self.view NightWithType:UIViewColorTypeNormal];
//    _dataSource = [NSMutableArray array];
    [self.view addSubview:self.tableView];
    self.title = @"播放列表";
    
}

#pragma mark 视图将出现时
-(void)viewWillAppear:(BOOL)animated
{
    self.navigationController.navigationBar.translucent = NO;
}
-(void)viewWillDisappear:(BOOL)animated
{
//    [PlayerButton shareButton].hidden = YES;
    self.navigationController.navigationBar.translucent = YES;
}

#pragma mark tableview初始化
-(UITableView *)tableView
{
    if (!_tableView) {
        _tableView = [[UITableView alloc]initWithFrame:CGRectMake(0, 0, self.view.frame.size.width, self.view.frame.size.height - 64) style:UITableViewStylePlain];
        _tableView.dataSource = self;
        _tableView.delegate = self;
        [_tableView NightWithType:UIViewColorTypeNormal];
    }
    return _tableView;
}
#pragma mark tableview cell样式
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    static NSString *identifier = @"cell";
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:identifier];
    if (!cell) {
        cell = [[UITableViewCell alloc]initWithStyle:UITableViewCellStyleValue1 reuseIdentifier:identifier];
    }
    cell.accessoryType = 1;
    [cell NightWithType:UIViewColorTypeNormal];
    [cell.textLabel NightWithType:UIViewColorTypeNormal];
    cell.textLabel.text = [_dataSource[indexPath.row] title];
    return cell;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 60 * FitHeight;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return _dataSource.count;
}
-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    self.myBlock([_dataSource[indexPath.row] trackId], [_dataSource[indexPath.row] uid], [_dataSource[indexPath.row] title]);
    [self.navigationController popViewControllerAnimated:YES];
}


















- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
